<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

<head>
	<sx:head cache="false" />
	<link rel="stylesheet" href="/hrs-intranet/styles/displaytag.css" type="text/css" />
	<link rel="stylesheet" href="/hrs-intranet/styles/errortag.css" type="text/css" />
</head>
 
<div class="left">
<s:form validate="true" cssClass="formClass" method="post">
 <s:hidden key="requestId"/>
 <s:hidden key="editSelected"/>
 <s:hidden key="actionMethod" value="%{actionMethod}"/>

<s:if test="hasFieldErrors()">
	<div class="oldErrorMsg">
		<h4 class="oldErrorTitle">Error(s) with submission:</h4>
		<s:iterator value="fieldErrors">
			<s:iterator value="value">
				<li>
					<font class="errorMsgFont">
						<s:property/>
					</font>
				</li>
			</s:iterator>
		</s:iterator>
	</div>
	<br/>
	<br/>
</s:if>

<s:if test="(requestId != 0 && actionMethod == 'ManageSecurityGroupAction_save')">
	<h2>Edit Security Group</h2>
</s:if>
<s:elseif test="(actionMethod == 'ManageSecurityGroupAction_form')">
	<h2>Security Group Details</h2>
</s:elseif>
<s:elseif test="(actionMethod == 'ManageSecurityGroupAction_save')">
	<h2>Create Security Groups</h2>
</s:elseif>
 
 <s:textfield key="securityGroup.name" readonly="%{readOnly}" disabled="%{readOnly}" label="Security Group Name" required="true" maxlength="20"/>
 <s:textfield key="securityGroup.description" readonly="%{readOnly}" disabled="%{readOnly}" label="Description" required="true" maxlength="50" />

 <s:optiontransferselect id="roles" disabled="%{readOnly}" allowUpDownOnLeft="false" allowUpDownOnRight="false" list="sortedPermissions" leftTitle="Permissions"  cssStyle="width:450px" doubleCssStyle="width:450px"
		doubleList="selectedSortedPermissions" rightTitle="Selected permissions" doubleName="selectedPermissionsIds" />

	<s:optiontransferselect id="userNames" disabled="%{readOnly}" allowUpDownOnLeft="false" allowUpDownOnRight="false" list="userNames" leftTitle="Users" cssStyle="width:450px" doubleCssStyle="width:450px" 
		doubleList="selectedUserNames" rightTitle="Selected users" doubleName="selectedUserNamesIds" />

	<s:if test="!readOnly"> 
	 	<s:submit action="%{actionMethod}" key="OK" cssClass="btn" cssStyle="position:relative; left:-95px;" id="okbutton"/>
 		<s:submit action="%{actionMethod}" key="Cancel" cssClass="btnCancel" method="list" cssStyle="position:relative; left:0px; top:-25px; _top:-27" id="cancelbutton"/>	 	
 	</s:if>
	<s:elseif test="readOnly"> 
 		<s:submit action="%{actionMethod}" key="Cancel" cssClass="btnCancel" method="list" cssStyle="position:relative; left:0px;" id="cancelbutton"/>
 	</s:elseif>
</s:form>
</div>
<div class="right">
	<s:if test="readOnly">
		<s:hidden key="actionMethod" value="ManageSecurityGroupAction_edit"/>
		<s:url id="edit_action" action="ManageSecurityGroupAction_edit" includeParams="all"/>
		<s:a href="%{edit_action}" cssClass="Add">Edit</s:a>
	</s:if>
</div>
